##Setup

  1. Map Ensembl ID to Gene Symbol in the counts file

  2. Write Counts Data with Gene Symbol to CSV

  3. Reading and filtering Hippocampus count and metadata files

  4. Reading and filtering Cortex count and metadata files

  5. Cortex: APP (APP vs WT) only - No Covariates (~APP)

## Cortex: Running DESeq2 for APP (APP vs WT) only - No Covariates:padj < 0.05 and 0.10
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 446 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## resultsNames:
## [1] "Intercept"     "APP_APP_vs_WT"
## 
## out of 34797 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up)       : 4493, 13%
## LFC < 0 (down)     : 4383, 13%
## outliers [1]       : 0, 0%
## low counts [2]     : 8852, 25%
## (mean count < 1)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
## log2 fold change (MLE): APP APP vs WT 
## Wald test p-value: APP APP vs WT 
## DataFrame with 10 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE      stat       pvalue
##                    <numeric>      <numeric> <numeric> <numeric>    <numeric>
## ENSMUSG00000068129 1858.8971        7.63594  0.252402   30.2530 4.76057e-201
## ENSMUSG00000079293  823.4879        6.23519  0.225957   27.5946 1.29026e-167
## ENSMUSG00000030789 1139.3238        6.46825  0.246666   26.2227 1.46409e-151
## ENSMUSG00000018927  788.3634        3.97689  0.152227   26.1247 1.90955e-150
## ENSMUSG00000000982  183.1320        4.56670  0.220314   20.7281  1.93133e-95
## ENSMUSG00000018930   37.1405        4.06970  0.202652   20.0822  1.05540e-89
## ENSMUSG00000046805 6682.6045        2.10279  0.105483   19.9349  2.02842e-88
## ENSMUSG00000018774 1709.7846        2.44287  0.124775   19.5782  2.37418e-85
## ENSMUSG00000097415  416.7944        2.21973  0.114782   19.3387  2.53764e-83
## ENSMUSG00000000682  382.4139        2.73088  0.141995   19.2322  1.98926e-82
##                            padj
##                       <numeric>
## ENSMUSG00000068129 1.23908e-196
## ENSMUSG00000079293 1.67914e-163
## ENSMUSG00000030789 1.27024e-147
## ENSMUSG00000018927 1.24255e-146
## ENSMUSG00000000982  1.00538e-91
## ENSMUSG00000018930  4.57831e-86
## ENSMUSG00000046805  7.54225e-85
## ENSMUSG00000018774  7.72439e-82
## ENSMUSG00000097415  7.33885e-80
## ENSMUSG00000000682  5.17765e-79
## log2 fold change (MLE): APP APP vs WT 
## Wald test p-value: APP APP vs WT 
## DataFrame with 34880 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE       stat       pvalue
##                    <numeric>      <numeric> <numeric>  <numeric>    <numeric>
## ENSMUSG00000068129  1858.897        7.63594  0.252402    30.2530 4.76057e-201
## ENSMUSG00000079293   823.488        6.23519  0.225957    27.5946 1.29026e-167
## ENSMUSG00000030789  1139.324        6.46825  0.246666    26.2227 1.46409e-151
## ENSMUSG00000018927   788.363        3.97689  0.152227    26.1247 1.90955e-150
## ENSMUSG00000000982   183.132        4.56670  0.220314    20.7281  1.93133e-95
## ...                      ...            ...       ...        ...          ...
## ENSMUSG00000064359  0.161461     -0.1461917   1.42846 -0.1023419     0.918485
## ENSMUSG00000064366  0.117536     -0.0179202   1.39008 -0.0128914     0.989714
## ENSMUSG00000095672  0.103382      0.3503108   1.63587  0.2141436     0.830435
## ENSMUSG00000079222  0.124061      0.3438527   1.71212  0.2008341     0.840828
## ENSMUSG00000079794  0.341101     -0.7071001   1.00281 -0.7051189     0.480736
##                            padj
##                       <numeric>
## ENSMUSG00000068129 1.23908e-196
## ENSMUSG00000079293 1.67914e-163
## ENSMUSG00000030789 1.27024e-147
## ENSMUSG00000018927 1.24255e-146
## ENSMUSG00000000982  1.00538e-91
## ...                         ...
## ENSMUSG00000064359           NA
## ENSMUSG00000064366           NA
## ENSMUSG00000095672           NA
## ENSMUSG00000079222           NA
## ENSMUSG00000079794           NA
## class: DESeqDataSet 
## dim: 34880 96 
## metadata(1): version
## assays(6): counts mu ... replaceCounts replaceCooks
## rownames(34880): ENSMUSG00000102628 ENSMUSG00000097426 ...
##   ENSMUSG00000095041 ENSMUSG00000095742
## rowData names(23): baseMean baseVar ... maxCooks replace
## colnames(96): 102 103 ... 95 96
## colData names(6): Sex Diet ... sizeFactor replaceable
## Cortex DESeq2 result is saved in file: 'Cortex_deseq_results_APP_only.csv'
## Cortex DESeq2 normalized counts is saved in file: 'Cortex_deseq_norm_counts_APP_only.csv'
## Cortex DESeq2 result with Gene names (mgi_symbols) is saved in file: 'Cortex_deseq_results_with_genename_APP_only.csv'
## [1] 34880
## [1] 7419
## Cortex DESeq2 result after padj (0.05) filtering is saved in file: 'Cortex_deseq_results_APP_only_padj_05_filtered.csv'
## Number of DE genes significant at padj < 0.05 for Cortex:APP (APP vs WT): 7419
## Number of DE genes discarded after padj threshold 0.05 filtering for Cortex:APP(APP vs WT): 27461

## [1] 34880
## [1] 8876
## Cortex DESeq2 result after padj (0.1) filtering is saved in file: 'Cortex_deseq_results_APP_only_padj_1_filtered.csv'
## Number of DE genes significant at padj < 0.1 for Cortex:APP (APP vs WT): 8876
## Number of DE genes discarded after padj threshold 0.1 filtering for Cortex:APP(APP vs WT) : 26004

  1. Cortex: Enhanced Volcano Plot
## Warning: ggrepel: 7394 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

  1. Cortex: Heatmap

8 Cortex: PCA

## ************** Principal Component Analysis (PCA) **************
## class: DESeqTransform 
## dim: 34880 96 
## metadata(1): version
## assays(1): ''
## rownames(34880): ENSMUSG00000102628 ENSMUSG00000097426 ...
##   ENSMUSG00000095041 ENSMUSG00000095742
## rowData names(23): baseMean baseVar ... maxCooks replace
## colnames(96): 102 103 ... 95 96
## colData names(6): Sex Diet ... sizeFactor replaceable
## Importance of components:
##                            PC1     PC2      PC3     PC4      PC5      PC6
## Standard deviation     62.0691 47.2091 43.43561 39.2192 30.52674 28.06197
## Proportion of Variance  0.1105  0.0639  0.05409  0.0441  0.02672  0.02258
## Cumulative Proportion   0.1105  0.1744  0.22844  0.2725  0.29925  0.32183
##                             PC7      PC8      PC9     PC10     PC11     PC12
## Standard deviation     27.87897 26.57108 25.07750 24.19879 23.78723 22.48140
## Proportion of Variance  0.02228  0.02024  0.01803  0.01679  0.01622  0.01449
## Cumulative Proportion   0.34411  0.36435  0.38238  0.39917  0.41540  0.42989
##                            PC13     PC14     PC15     PC16     PC17    PC18
## Standard deviation     21.64538 20.17774 19.77058 19.23614 19.02146 18.7665
## Proportion of Variance  0.01343  0.01167  0.01121  0.01061  0.01037  0.0101
## Cumulative Proportion   0.44332  0.45499  0.46620  0.47681  0.48718  0.4973
##                            PC19     PC20     PC21     PC22     PC23     PC24
## Standard deviation     18.42451 18.17533 18.04444 17.78258 17.60624 17.38005
## Proportion of Variance  0.00973  0.00947  0.00933  0.00907  0.00889  0.00866
## Cumulative Proportion   0.50701  0.51648  0.52581  0.53488  0.54377  0.55243
##                            PC25     PC26     PC27     PC28     PC29     PC30
## Standard deviation     17.26232 17.19011 16.97787 16.92400 16.83790 16.72540
## Proportion of Variance  0.00854  0.00847  0.00826  0.00821  0.00813  0.00802
## Cumulative Proportion   0.56097  0.56944  0.57771  0.58592  0.59405  0.60207
##                            PC31     PC32     PC33     PC34     PC35     PC36
## Standard deviation     16.56356 16.40628 16.36023 16.31078 16.11885 16.01803
## Proportion of Variance  0.00787  0.00772  0.00767  0.00763  0.00745  0.00736
## Cumulative Proportion   0.60993  0.61765  0.62532  0.63295  0.64040  0.64775
##                            PC37     PC38     PC39     PC40     PC41     PC42
## Standard deviation     15.94019 15.85598 15.83916 15.78594 15.77478 15.65578
## Proportion of Variance  0.00728  0.00721  0.00719  0.00714  0.00713  0.00703
## Cumulative Proportion   0.65504  0.66225  0.66944  0.67658  0.68372  0.69074
##                            PC43     PC44     PC45     PC46     PC47     PC48
## Standard deviation     15.61466 15.55155 15.47870 15.43806 15.36342 15.32200
## Proportion of Variance  0.00699  0.00693  0.00687  0.00683  0.00677  0.00673
## Cumulative Proportion   0.69774  0.70467  0.71154  0.71837  0.72514  0.73187
##                            PC49     PC50     PC51     PC52     PC53     PC54
## Standard deviation     15.27167 15.24753 15.19989 15.12776 15.10515 15.04049
## Proportion of Variance  0.00669  0.00667  0.00662  0.00656  0.00654  0.00649
## Cumulative Proportion   0.73855  0.74522  0.75184  0.75841  0.76495  0.77143
##                            PC55     PC56     PC57     PC58    PC59     PC60
## Standard deviation     15.00100 14.98112 14.89375 14.83836 14.8294 14.81184
## Proportion of Variance  0.00645  0.00643  0.00636  0.00631  0.0063  0.00629
## Cumulative Proportion   0.77788  0.78432  0.79068  0.79699  0.8033  0.80958
##                            PC61    PC62     PC63     PC64    PC65     PC66
## Standard deviation     14.72891 14.7073 14.69490 14.60399 14.5829 14.52986
## Proportion of Variance  0.00622  0.0062  0.00619  0.00611  0.0061  0.00605
## Cumulative Proportion   0.81580  0.8220  0.82820  0.83431  0.8404  0.84646
##                            PC67     PC68     PC69     PC70     PC71     PC72
## Standard deviation     14.50349 14.42430 14.39881 14.32419 14.29788 14.27752
## Proportion of Variance  0.00603  0.00597  0.00594  0.00588  0.00586  0.00584
## Cumulative Proportion   0.85249  0.85846  0.86440  0.87028  0.87614  0.88199
##                           PC73     PC74     PC75     PC76     PC77    PC78
## Standard deviation     14.2207 14.14266 14.11283 14.06282 14.04241 13.9728
## Proportion of Variance  0.0058  0.00573  0.00571  0.00567  0.00565  0.0056
## Cumulative Proportion   0.8878  0.89352  0.89923  0.90490  0.91055  0.9162
##                            PC79     PC80     PC81     PC82     PC83    PC84
## Standard deviation     13.90497 13.85897 13.76516 13.73979 13.62045 13.5923
## Proportion of Variance  0.00554  0.00551  0.00543  0.00541  0.00532  0.0053
## Cumulative Proportion   0.92169  0.92720  0.93263  0.93805  0.94336  0.9487
##                            PC85     PC86     PC87     PC88     PC89     PC90
## Standard deviation     13.52340 13.48809 13.37789 13.17780 12.99373 12.84734
## Proportion of Variance  0.00524  0.00522  0.00513  0.00498  0.00484  0.00473
## Cumulative Proportion   0.95390  0.95912  0.96425  0.96923  0.97407  0.97880
##                            PC91     PC92     PC93     PC94     PC95      PC96
## Standard deviation     12.72544 12.51280 12.35435 11.73444 11.42502 3.713e-13
## Proportion of Variance  0.00464  0.00449  0.00438  0.00395  0.00374 0.000e+00
## Cumulative Proportion   0.98345  0.98793  0.99231  0.99626  1.00000 1.000e+00
##  [1] 1.104523e-01 6.389620e-02 5.408981e-02 4.409825e-02 2.671680e-02
##  [6] 2.257666e-02 2.228316e-02 2.024147e-02 1.802984e-02 1.678846e-02
## [11] 1.622225e-02 1.449006e-02 1.343241e-02 1.167263e-02 1.120630e-02
## [16] 1.060863e-02 1.037316e-02 1.009699e-02 9.732303e-03 9.470829e-03
## [21] 9.334919e-03 9.065941e-03 8.887031e-03 8.660152e-03 8.543222e-03
## [26] 8.471899e-03 8.263990e-03 8.211633e-03 8.128294e-03 8.020042e-03
## [31] 7.865585e-03 7.716912e-03 7.673654e-03 7.627341e-03 7.448890e-03
## [36] 7.355997e-03 7.284677e-03 7.207920e-03 7.192632e-03 7.144382e-03
## [41] 7.134284e-03 7.027045e-03 6.990184e-03 6.933794e-03 6.868981e-03
## [46] 6.832965e-03 6.767046e-03 6.730607e-03 6.686469e-03 6.665340e-03
## [51] 6.623758e-03 6.561040e-03 6.541448e-03 6.485561e-03 6.451549e-03
## [56] 6.434456e-03 6.359627e-03 6.312414e-03 6.304828e-03 6.289864e-03
## [61] 6.219631e-03 6.201412e-03 6.190941e-03 6.114583e-03 6.096942e-03
## [66] 6.052662e-03 6.030712e-03 5.965036e-03 5.943972e-03 5.882525e-03
## [71] 5.860931e-03 5.844257e-03 5.797795e-03 5.734371e-03 5.710205e-03
## [76] 5.669810e-03 5.653365e-03 5.597449e-03 5.543242e-03 5.506624e-03
## [81] 5.432328e-03 5.412325e-03 5.318715e-03 5.296717e-03 5.243187e-03
## [86] 5.215842e-03 5.130965e-03 4.978622e-03 4.840509e-03 4.732060e-03
## [91] 4.642685e-03 4.488825e-03 4.375861e-03 3.947741e-03 3.742292e-03
## [96] 3.951672e-30
## # A tibble: 5 × 3
##   variance_explained principal_components cumulative
##                <dbl> <chr>                     <dbl>
## 1             0.110  PC1                       0.110
## 2             0.0639 PC2                       0.174
## 3             0.0541 PC3                       0.228
## 4             0.0441 PC4                       0.273
## 5             0.0267 PC5                       0.299

  1. Hippocampus: APP (APP vs WT) only - No Covariates (~APP)
## Hippocampus: Running DESeq2 for APP (APP vs WT):padj < 0.05 and 0.10
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 321 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## resultsNames:
## [1] "Intercept"     "APP_APP_vs_WT"
## 
## out of 33266 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up)       : 4297, 13%
## LFC < 0 (down)     : 4292, 13%
## outliers [1]       : 0, 0%
## low counts [2]     : 12259, 37%
## (mean count < 3)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
## log2 fold change (MLE): APP APP vs WT 
## Wald test p-value: APP APP vs WT 
## DataFrame with 10 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE      stat       pvalue
##                    <numeric>      <numeric> <numeric> <numeric>    <numeric>
## ENSMUSG00000068129  933.4821        7.16600  0.278978   25.6866 1.64998e-145
## ENSMUSG00000079293  468.4345        4.70708  0.217993   21.5928 2.09802e-103
## ENSMUSG00000030789  453.6241        5.58720  0.272981   20.4673  4.21204e-93
## ENSMUSG00000018927  440.8573        3.04395  0.162382   18.7456  2.10212e-78
## ENSMUSG00000000982   80.2961        3.76934  0.235526   16.0039  1.19998e-57
## ENSMUSG00000046805 4465.5369        1.69614  0.110259   15.3832  2.12193e-53
## ENSMUSG00000000682  187.4863        2.62909  0.174659   15.0527  3.31469e-51
## ENSMUSG00000021423 1263.4021        1.60099  0.110871   14.4402  2.89104e-47
## ENSMUSG00000040552  308.6785        1.70861  0.120614   14.1659  1.48931e-45
## ENSMUSG00000097415  303.0665        1.69829  0.120206   14.1281  2.54864e-45
##                            padj
##                       <numeric>
## ENSMUSG00000068129 3.46695e-141
## ENSMUSG00000079293  2.20418e-99
## ENSMUSG00000030789  2.95011e-89
## ENSMUSG00000018927  1.10424e-74
## ENSMUSG00000000982  5.04278e-54
## ENSMUSG00000046805  7.43101e-50
## ENSMUSG00000000682  9.94977e-48
## ENSMUSG00000021423  7.59331e-44
## ENSMUSG00000040552  3.47704e-42
## ENSMUSG00000097415  5.35521e-42
## log2 fold change (MLE): APP APP vs WT 
## Wald test p-value: APP APP vs WT 
## DataFrame with 33271 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE       stat       pvalue
##                    <numeric>      <numeric> <numeric>  <numeric>    <numeric>
## ENSMUSG00000068129  933.4821        7.16600  0.278978    25.6866 1.64998e-145
## ENSMUSG00000079293  468.4345        4.70708  0.217993    21.5928 2.09802e-103
## ENSMUSG00000030789  453.6241        5.58720  0.272981    20.4673  4.21204e-93
## ENSMUSG00000018927  440.8573        3.04395  0.162382    18.7456  2.10212e-78
## ENSMUSG00000000982   80.2961        3.76934  0.235526    16.0039  1.19998e-57
## ...                      ...            ...       ...        ...          ...
## ENSMUSG00000064369 2.5058343     -0.3644526  0.257539 -1.4151343    0.1570291
## ENSMUSG00000079190 0.2880846      0.9808730  1.373280  0.7142555    0.4750692
## ENSMUSG00000079222 0.0739574      0.0800712  2.844467  0.0281498    0.9775427
## ENSMUSG00000062783 0.1831708      0.4845350  1.573588  0.3079172    0.7581453
## ENSMUSG00000079808 0.7429405      1.3749869  0.721256  1.9063780    0.0566012
##                            padj
##                       <numeric>
## ENSMUSG00000068129 3.46695e-141
## ENSMUSG00000079293  2.20418e-99
## ENSMUSG00000030789  2.95011e-89
## ENSMUSG00000018927  1.10424e-74
## ENSMUSG00000000982  5.04278e-54
## ...                         ...
## ENSMUSG00000064369           NA
## ENSMUSG00000079190           NA
## ENSMUSG00000079222           NA
## ENSMUSG00000062783           NA
## ENSMUSG00000079808           NA
## class: DESeqDataSet 
## dim: 33271 96 
## metadata(1): version
## assays(6): counts mu ... replaceCounts replaceCooks
## rownames(33271): ENSMUSG00000102628 ENSMUSG00000086053 ...
##   ENSMUSG00000095041 ENSMUSG00000095742
## rowData names(23): baseMean baseVar ... maxCooks replace
## colnames(96): 102 103 ... 95 96
## colData names(6): Sex Diet ... sizeFactor replaceable
## Hippocampus DESeq2 result is saved in file: 'Hippocampus_deseq_results_APP_only.csv'
## Hippocampus DESeq2 normalized counts is saved in file: 'Hippocampus_deseq_norm_counts_APP_only.csv'
## Hippocampus DESeq2 result with Gene names (mgi_symbols) is saved in file: 'Hippocampus_deseq_results_with_genename_APP_only.csv'
## Hippocampus DESeq2 result after padj (0.05) filtering is saved in file: 'Hippocampus_deseq_results_APP_only_padj_05_filtered.csv'
## Number of DE genes significant at padj < 0.05 for Hippocampus:APP (APP vs WT): 6292
## Number of DE genes discarded after padj threshold < 0.05 filtering for Hippocampus:APP (APP vs WT): 26979

## Hippocampus DESeq2 result after padj (0.1) filtering is saved in file: 'Hippocampus_deseq_results_APP_only_padj_1_filtered.csv'
## Number of DE genes significant at padj < 0.1 for Hippocampus:APP (APP vs WT): 8589
## Number of DE genes discarded after padj threshold < 0.1 filtering for Hippocampus:APP(APP vs WT) only: 24682

  1. Hippocampus: Enhanced Volcano Plot
## Warning: ggrepel: 6274 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

  1. Hippocampus: Heatmap

12 Hippocampus: PCA

## ************** Principal Component Analysis (PCA) **************
## class: DESeqTransform 
## dim: 33271 96 
## metadata(1): version
## assays(1): ''
## rownames(33271): ENSMUSG00000102628 ENSMUSG00000086053 ...
##   ENSMUSG00000095041 ENSMUSG00000095742
## rowData names(23): baseMean baseVar ... maxCooks replace
## colnames(96): 102 103 ... 95 96
## colData names(6): Sex Diet ... sizeFactor replaceable
## Importance of components:
##                            PC1      PC2      PC3      PC4      PC5     PC6
## Standard deviation     90.3374 40.46986 32.62333 29.76544 26.69543 25.7985
## Proportion of Variance  0.2453  0.04923  0.03199  0.02663  0.02142  0.0200
## Cumulative Proportion   0.2453  0.29451  0.32650  0.35313  0.37455  0.3946
##                            PC7      PC8      PC9     PC10     PC11    PC12
## Standard deviation     22.4106 21.61071 20.40882 19.90844 19.61700 19.1281
## Proportion of Variance  0.0151  0.01404  0.01252  0.01191  0.01157  0.0110
## Cumulative Proportion   0.4097  0.42368  0.43620  0.44812  0.45968  0.4707
##                            PC13     PC14     PC15     PC16     PC17     PC18
## Standard deviation     18.65039 18.45338 18.06351 17.53585 17.26056 16.77386
## Proportion of Variance  0.01045  0.01023  0.00981  0.00924  0.00895  0.00846
## Cumulative Proportion   0.48113  0.49137  0.50118  0.51042  0.51937  0.52783
##                            PC19     PC20    PC21     PC22     PC23     PC24
## Standard deviation     16.66584 16.55476 16.2123 16.16840 16.07476 15.98455
## Proportion of Variance  0.00835  0.00824  0.0079  0.00786  0.00777  0.00768
## Cumulative Proportion   0.53618  0.54441  0.5523  0.56017  0.56794  0.57562
##                           PC25     PC26     PC27     PC28     PC29     PC30
## Standard deviation     15.7913 15.76898 15.74085 15.65944 15.59203 15.47032
## Proportion of Variance  0.0075  0.00747  0.00745  0.00737  0.00731  0.00719
## Cumulative Proportion   0.5831  0.59059  0.59803  0.60540  0.61271  0.61990
##                            PC31     PC32     PC33     PC34     PC35    PC36
## Standard deviation     15.45627 15.35796 15.26783 15.22922 15.22245 15.1526
## Proportion of Variance  0.00718  0.00709  0.00701  0.00697  0.00696  0.0069
## Cumulative Proportion   0.62708  0.63417  0.64118  0.64815  0.65512  0.6620
##                            PC37     PC38     PC39     PC40     PC41     PC42
## Standard deviation     15.11612 15.08163 15.01432 14.94051 14.90765 14.85063
## Proportion of Variance  0.00687  0.00684  0.00678  0.00671  0.00668  0.00663
## Cumulative Proportion   0.66888  0.67572  0.68250  0.68921  0.69589  0.70251
##                            PC43     PC44     PC45    PC46    PC47     PC48
## Standard deviation     14.83491 14.77117 14.71755 14.7031 14.5899 14.57080
## Proportion of Variance  0.00661  0.00656  0.00651  0.0065  0.0064  0.00638
## Cumulative Proportion   0.70913  0.71569  0.72220  0.7287  0.7351  0.74147
##                            PC49     PC50     PC51     PC52     PC53     PC54
## Standard deviation     14.52834 14.48721 14.44832 14.43433 14.40562 14.33001
## Proportion of Variance  0.00634  0.00631  0.00627  0.00626  0.00624  0.00617
## Cumulative Proportion   0.74782  0.75413  0.76040  0.76666  0.77290  0.77907
##                            PC55     PC56     PC57     PC58     PC59     PC60
## Standard deviation     14.29824 14.23271 14.20749 14.19897 14.14211 14.11407
## Proportion of Variance  0.00614  0.00609  0.00607  0.00606  0.00601  0.00599
## Cumulative Proportion   0.78522  0.79130  0.79737  0.80343  0.80944  0.81543
##                            PC61     PC62     PC63     PC64     PC65     PC66
## Standard deviation     14.09262 14.05855 13.98753 13.96748 13.93105 13.90883
## Proportion of Variance  0.00597  0.00594  0.00588  0.00586  0.00583  0.00581
## Cumulative Proportion   0.82140  0.82734  0.83322  0.83908  0.84492  0.85073
##                            PC67     PC68     PC69     PC70     PC71     PC72
## Standard deviation     13.80496 13.75903 13.73146 13.68519 13.64327 13.60492
## Proportion of Variance  0.00573  0.00569  0.00567  0.00563  0.00559  0.00556
## Cumulative Proportion   0.85646  0.86215  0.86782  0.87345  0.87904  0.88460
##                           PC73     PC74     PC75     PC76     PC77     PC78
## Standard deviation     13.5271 13.45292 13.41007 13.39542 13.34023 13.31905
## Proportion of Variance  0.0055  0.00544  0.00541  0.00539  0.00535  0.00533
## Cumulative Proportion   0.8901  0.89554  0.90095  0.90634  0.91169  0.91702
##                            PC79     PC80     PC81     PC82     PC83     PC84
## Standard deviation     13.25343 13.20297 13.16718 13.11305 13.05575 12.99794
## Proportion of Variance  0.00528  0.00524  0.00521  0.00517  0.00512  0.00508
## Cumulative Proportion   0.92230  0.92754  0.93275  0.93792  0.94304  0.94812
##                            PC85     PC86     PC87    PC88     PC89     PC90
## Standard deviation     12.91775 12.87196 12.78578 12.7670 12.70706 12.60887
## Proportion of Variance  0.00502  0.00498  0.00491  0.0049  0.00485  0.00478
## Cumulative Proportion   0.95314  0.95812  0.96303  0.9679  0.97278  0.97756
##                            PC91     PC92     PC93     PC94     PC95      PC96
## Standard deviation     12.48854 12.46730 12.44995 11.90737 11.76471 2.458e-13
## Proportion of Variance  0.00469  0.00467  0.00466  0.00426  0.00416 0.000e+00
## Cumulative Proportion   0.98225  0.98692  0.99158  0.99584  1.00000 1.000e+00
##  [1] 2.452838e-01 4.922635e-02 3.198827e-02 2.662923e-02 2.141943e-02
##  [6] 2.000425e-02 1.509528e-02 1.403693e-02 1.251901e-02 1.191265e-02
## [11] 1.156643e-02 1.099715e-02 1.045467e-02 1.023495e-02 9.807052e-03
## [16] 9.242464e-03 8.954553e-03 8.456684e-03 8.348116e-03 8.237204e-03
## [21] 7.899945e-03 7.857205e-03 7.766457e-03 7.679536e-03 7.495002e-03
## [26] 7.473797e-03 7.447158e-03 7.370326e-03 7.307010e-03 7.193371e-03
## [31] 7.180312e-03 7.089265e-03 7.006298e-03 6.970914e-03 6.964709e-03
## [36] 6.900909e-03 6.867754e-03 6.836449e-03 6.775561e-03 6.709111e-03
## [41] 6.679634e-03 6.628630e-03 6.614608e-03 6.557889e-03 6.510362e-03
## [46] 6.497571e-03 6.397930e-03 6.381177e-03 6.344046e-03 6.308175e-03
## [51] 6.274350e-03 6.262211e-03 6.237323e-03 6.172016e-03 6.144683e-03
## [56] 6.088482e-03 6.066932e-03 6.059651e-03 6.011217e-03 5.987405e-03
## [61] 5.969217e-03 5.940395e-03 5.880525e-03 5.863676e-03 5.833135e-03
## [66] 5.814541e-03 5.728022e-03 5.689970e-03 5.667192e-03 5.629055e-03
## [71] 5.594622e-03 5.563216e-03 5.499717e-03 5.439603e-03 5.405009e-03
## [76] 5.393200e-03 5.348855e-03 5.331880e-03 5.279473e-03 5.239347e-03
## [81] 5.210986e-03 5.168228e-03 5.123162e-03 5.077892e-03 5.015426e-03
## [86] 4.979936e-03 4.913476e-03 4.899035e-03 4.853160e-03 4.778443e-03
## [91] 4.687677e-03 4.671740e-03 4.658749e-03 4.261530e-03 4.160034e-03
## [96] 1.815907e-30
## # A tibble: 5 × 3
##   variance_explained principal_components cumulative
##                <dbl> <chr>                     <dbl>
## 1             0.245  PC1                       0.245
## 2             0.0492 PC2                       0.295
## 3             0.0320 PC3                       0.326
## 4             0.0266 PC4                       0.353
## 5             0.0214 PC5                       0.375

  1. GSEA:Running fgsea

Perform a GSEA using a ranked list log2FoldChange values for all genes discovered in the DESeq2 results against the M2 Canonical Pathways gene set collection. Convert gene identifiers in the results to the appropriate matching format found in the M2 gene sets. fgsea expects a named vector of gene level statistics and the gene sets in the form of a named list.

Using “m2.cp.wikipathways.v0.3.symbols.gmt” which is the Canonical Pathways gene sets derived from the WikiPathways pathway database (WikiPathways subset of CP)

## # A tibble: 34,880 × 8
##    genes              volc_plo…¹ log2F…²      padj baseM…³ lfcSE  stat    pvalue
##    <chr>              <chr>        <dbl>     <dbl>   <dbl> <dbl> <dbl>     <dbl>
##  1 ENSMUSG00000068129 UP            7.64 1.24e-196  1859.  0.252  30.3 4.76e-201
##  2 ENSMUSG00000079293 UP            6.24 1.68e-163   823.  0.226  27.6 1.29e-167
##  3 ENSMUSG00000030789 UP            6.47 1.27e-147  1139.  0.247  26.2 1.46e-151
##  4 ENSMUSG00000018927 UP            3.98 1.24e-146   788.  0.152  26.1 1.91e-150
##  5 ENSMUSG00000000982 UP            4.57 1.01e- 91   183.  0.220  20.7 1.93e- 95
##  6 ENSMUSG00000018930 UP            4.07 4.58e- 86    37.1 0.203  20.1 1.06e- 89
##  7 ENSMUSG00000046805 UP            2.10 7.54e- 85  6683.  0.105  19.9 2.03e- 88
##  8 ENSMUSG00000018774 UP            2.44 7.72e- 82  1710.  0.125  19.6 2.37e- 85
##  9 ENSMUSG00000097415 UP            2.22 7.34e- 80   417.  0.115  19.3 2.54e- 83
## 10 ENSMUSG00000000682 UP            2.73 5.18e- 79   382.  0.142  19.2 1.99e- 82
## # … with 34,870 more rows, and abbreviated variable names ¹​volc_plot_status,
## #   ²​log2FoldChange, ³​baseMean
## # ℹ Use `print(n = ...)` to see more rows
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.14% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize,
## gseaParam, : There are duplicate gene names, fgsea may produce unexpected
## results.
## # A tibble: 190 × 8
##    pathway                       pval    padj log2err     ES   NES  size leadi…¹
##    <chr>                        <dbl>   <dbl>   <dbl>  <dbl> <dbl> <int> <list> 
##  1 WP_MONOAMINE_GPCRS         3.25e-5 6.17e-4   0.557 -0.647 -2.13    33 <chr>  
##  2 WP_HYPOTHETICAL_NETWORK_F… 3.83e-5 6.62e-4   0.557 -0.645 -2.07    31 <chr>  
##  3 WP_HYPOXIADEPENDENT_DIFFE… 9.20e-4 1.09e-2   0.477 -0.738 -1.96    13 <chr>  
##  4 WP_HYPOXIADEPENDENT_SELFR… 1.51e-3 1.69e-2   0.455 -0.724 -1.92    13 <chr>  
##  5 WP_SPLICING_FACTOR_NOVA_R… 4.64e-3 3.83e-2   0.407 -0.487 -1.69    41 <chr>  
##  6 WP_GPCRS_CLASS_C_METABOTR… 2.63e-2 1.28e-1   0.352 -0.579 -1.60    15 <chr>  
##  7 WP_HYPOXIADEPENDENT_PROLI… 3.85e-2 1.74e-1   0.322 -0.524 -1.53    19 <chr>  
##  8 WP_ACETYLCHOLINE_SYNTHESIS 8.99e-2 3.42e-1   0.253 -0.688 -1.47     7 <chr>  
##  9 WP_REGULATION_OF_CARDIAC_… 1.24e-1 4.37e-1   0.211 -0.687 -1.40     6 <chr>  
## 10 WP_BIOGENIC_AMINE_SYNTHES… 2.30e-1 5.88e-1   0.178 -0.438 -1.21    15 <chr>  
## # … with 180 more rows, and abbreviated variable name ¹​leadingEdge
## # ℹ Use `print(n = ...)` to see more rows
## Cortex NES ordered fgsea results saved in file: 'Cortex_NES_ordered_fgsea_results_APP_only_FC0.csv'

## # A tibble: 33,271 × 8
##    genes              volc_plo…¹ log2F…²      padj baseM…³ lfcSE  stat    pvalue
##    <chr>              <chr>        <dbl>     <dbl>   <dbl> <dbl> <dbl>     <dbl>
##  1 ENSMUSG00000068129 UP            7.17 3.47e-141   933.  0.279  25.7 1.65e-145
##  2 ENSMUSG00000079293 UP            4.71 2.20e- 99   468.  0.218  21.6 2.10e-103
##  3 ENSMUSG00000030789 UP            5.59 2.95e- 89   454.  0.273  20.5 4.21e- 93
##  4 ENSMUSG00000018927 UP            3.04 1.10e- 74   441.  0.162  18.7 2.10e- 78
##  5 ENSMUSG00000000982 UP            3.77 5.04e- 54    80.3 0.236  16.0 1.20e- 57
##  6 ENSMUSG00000046805 UP            1.70 7.43e- 50  4466.  0.110  15.4 2.12e- 53
##  7 ENSMUSG00000000682 UP            2.63 9.95e- 48   187.  0.175  15.1 3.31e- 51
##  8 ENSMUSG00000021423 UP            1.60 7.59e- 44  1263.  0.111  14.4 2.89e- 47
##  9 ENSMUSG00000040552 UP            1.71 3.48e- 42   309.  0.121  14.2 1.49e- 45
## 10 ENSMUSG00000097415 UP            1.70 5.36e- 42   303.  0.120  14.1 2.55e- 45
## # … with 33,261 more rows, and abbreviated variable names ¹​volc_plot_status,
## #   ²​log2FoldChange, ³​baseMean
## # ℹ Use `print(n = ...)` to see more rows
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.01% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.

## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are duplicate gene names, fgsea may produce unexpected results.
## # A tibble: 190 × 8
##    pathway                        pval  padj log2err     ES    NES  size leadi…¹
##    <chr>                         <dbl> <dbl>   <dbl>  <dbl>  <dbl> <int> <list> 
##  1 WP_NONHOMOLOGOUS_END_JOINING  0.356 0.620  0.110  -0.531 -1.09      6 <chr>  
##  2 WP_REGULATION_OF_CARDIAC_HYP… 0.5   0.714  0.0884 -0.484 -0.961     5 <chr>  
##  3 WP_METHYLATION                0.681 0.880  0.0767 -0.348 -0.813     9 <chr>  
##  4 WP_GLYCOGEN_METABOLISM        0.850 1      0.0779 -0.234 -0.770    34 <chr>  
##  5 WP_LEPTIN_AND_ADIPONECTIN     0.856 1      0.0645 -0.275 -0.676    10 <chr>  
##  6 WP_ONECARBON_METABOLISM_AND_… 0.967 1      0.0765 -0.182 -0.671    51 <chr>  
##  7 WP_EXERCISEINDUCED_CIRCADIAN… 0.993 1      0.0755 -0.183 -0.663    49 <chr>  
##  8 WP_SPLICING_FACTOR_NOVA_REGU… 0.976 1      0.0724 -0.183 -0.638    41 <chr>  
##  9 WP_AMINO_ACID_METABOLISM      0.995 1      0.0926 -0.153 -0.635    96 <chr>  
## 10 WP_FATTY_ACID_OMEGAOXIDATION  0.918 1      0.0585 -0.299 -0.614     6 <chr>  
## # … with 180 more rows, and abbreviated variable name ¹​leadingEdge
## # ℹ Use `print(n = ...)` to see more rows
## Hippocampus NES ordered fgsea results saved in file: 'Hippocampus_NES_ordered_fgsea_results_APP_only_FC0.csv'

  1. Total DEGs Bar Graph

  1. FGSEA on Thomas CSV Batch_of_192_Trimmed_Hippo_DESeq2_Control_v_Supp_12mo_APP_DGE_Analysis_sex_controlled_padj_sorted_7_23_2022.csv
## # A tibble: 17,899 × 8
##    genes              volc_plot_…¹ log2F…²    padj baseM…³  lfcSE  stat   pvalue
##    <chr>              <chr>          <dbl>   <dbl>   <dbl>  <dbl> <dbl>    <dbl>
##  1 ENSMUSG00000039617 DOWN         -21.9   1.44e-8    6.91 3.06   -7.15 8.74e-13
##  2 ENSMUSG00000064293 UP             0.819 1.54e-8  491.   0.116   7.04 1.87e-12
##  3 ENSMUSG00000057455 UP             0.372 2.95e-6 1937.   0.0599  6.21 5.38e-10
##  4 ENSMUSG00000052861 DOWN          -1.84  6.44e-6  108.   0.305  -6.04 1.56e- 9
##  5 ENSMUSG00000034467 DOWN          -1.36  7.68e-6   47.5  0.227  -5.97 2.33e- 9
##  6 ENSMUSG00000055430 UP             0.529 1.17e-5 4625.   0.0900  5.87 4.26e- 9
##  7 ENSMUSG00000039155 DOWN          -3.17  1.26e-5   24.6  0.542  -5.84 5.33e- 9
##  8 ENSMUSG00000037627 DOWN          -1.77  1.59e-5   46.1  0.307  -5.77 7.73e- 9
##  9 ENSMUSG00000028546 UP             0.515 9.97e-5 1264.   0.0954  5.40 6.52e- 8
## 10 ENSMUSG00000039543 DOWN          -1.46  9.97e-5   36.3  0.271  -5.40 6.66e- 8
## # … with 17,889 more rows, and abbreviated variable names ¹​volc_plot_status,
## #   ²​log2FoldChange, ³​baseMean
## # ℹ Use `print(n = ...)` to see more rows
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize,
## gseaParam, : There are duplicate gene names, fgsea may produce unexpected
## results.
## # A tibble: 190 × 8
##    pathway                         pval  padj log2err     ES   NES  size leadi…¹
##    <chr>                          <dbl> <dbl>   <dbl>  <dbl> <dbl> <int> <list> 
##  1 WP_TYPE_II_INTERFERON_SIGNAL… 0.0138 0.830   0.381 -0.697 -1.68    29 <chr>  
##  2 WP_MACROPHAGE_MARKERS         0.0413 0.830   0.322 -0.798 -1.58    10 <chr>  
##  3 WP_EICOSANOID_METABOLISM_VIA… 0.0421 0.830   0.277 -0.634 -1.53    28 <chr>  
##  4 WP_LEPTININSULIN_SIGNALING_O… 0.0795 0.830   0.288 -0.704 -1.53    16 <chr>  
##  5 WP_INFLAMMATORY_RESPONSE_PAT… 0.0425 0.830   0.277 -0.634 -1.52    27 <chr>  
##  6 WP_RETINOL_METABOLISM         0.0385 0.830   0.288 -0.607 -1.50    34 <chr>  
##  7 WP_DYSREGULATED_MIRNA_TARGET… 0.0514 0.830   0.249 -0.620 -1.48    26 <chr>  
##  8 WP_NUCLEOTIDE_GPCRS           0.0694 0.830   0.219 -0.721 -1.45    11 <chr>  
##  9 WP_GLUTATHIONE_METABOLISM     0.0710 0.830   0.211 -0.649 -1.44    19 <chr>  
## 10 WP_MATRIX_METALLOPROTEINASES  0.0862 0.830   0.190 -0.613 -1.41    22 <chr>  
## # … with 180 more rows, and abbreviated variable name ¹​leadingEdge
## # ℹ Use `print(n = ...)` to see more rows
## THippo NES ordered fgsea results saved in file: 'THippo_NES_ordered_fgsea_results_APP_only_FC0.csv'
## ************** FGSEA on Thomas CSV: log2FoldChange threshold = 0 **************

## # A tibble: 17,899 × 8
##    genes              volc_plot_…¹ log2F…²    padj baseM…³  lfcSE  stat   pvalue
##    <chr>              <chr>          <dbl>   <dbl>   <dbl>  <dbl> <dbl>    <dbl>
##  1 ENSMUSG00000039617 DOWN         -21.9   1.44e-8    6.91 3.06   -7.15 8.74e-13
##  2 ENSMUSG00000064293 DOWN           0.819 1.54e-8  491.   0.116   7.04 1.87e-12
##  3 ENSMUSG00000057455 DOWN           0.372 2.95e-6 1937.   0.0599  6.21 5.38e-10
##  4 ENSMUSG00000052861 DOWN          -1.84  6.44e-6  108.   0.305  -6.04 1.56e- 9
##  5 ENSMUSG00000034467 DOWN          -1.36  7.68e-6   47.5  0.227  -5.97 2.33e- 9
##  6 ENSMUSG00000055430 DOWN           0.529 1.17e-5 4625.   0.0900  5.87 4.26e- 9
##  7 ENSMUSG00000039155 DOWN          -3.17  1.26e-5   24.6  0.542  -5.84 5.33e- 9
##  8 ENSMUSG00000037627 DOWN          -1.77  1.59e-5   46.1  0.307  -5.77 7.73e- 9
##  9 ENSMUSG00000028546 DOWN           0.515 9.97e-5 1264.   0.0954  5.40 6.52e- 8
## 10 ENSMUSG00000039543 DOWN          -1.46  9.97e-5   36.3  0.271  -5.40 6.66e- 8
## # … with 17,889 more rows, and abbreviated variable names ¹​volc_plot_status,
## #   ²​log2FoldChange, ³​baseMean
## # ℹ Use `print(n = ...)` to see more rows
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize,
## gseaParam, : There are duplicate gene names, fgsea may produce unexpected
## results.
## # A tibble: 190 × 8
##    pathway                         pval  padj log2err     ES   NES  size leadi…¹
##    <chr>                          <dbl> <dbl>   <dbl>  <dbl> <dbl> <int> <list> 
##  1 WP_TYPE_II_INTERFERON_SIGNA… 0.00973 0.850   0.381 -0.697 -1.67    29 <chr>  
##  2 WP_MACROPHAGE_MARKERS        0.0252  0.850   0.352 -0.798 -1.53    10 <chr>  
##  3 WP_EICOSANOID_METABOLISM_VI… 0.0478  0.850   0.257 -0.634 -1.51    28 <chr>  
##  4 WP_LEPTININSULIN_SIGNALING_… 0.0489  0.850   0.262 -0.704 -1.51    16 <chr>  
##  5 WP_RETINOL_METABOLISM        0.0702  0.850   0.288 -0.607 -1.50    34 <chr>  
##  6 WP_INFLAMMATORY_RESPONSE_PA… 0.0518  0.850   0.249 -0.634 -1.49    27 <chr>  
##  7 WP_DYSREGULATED_MIRNA_TARGE… 0.0633  0.850   0.225 -0.620 -1.44    26 <chr>  
##  8 WP_GLUTATHIONE_METABOLISM    0.0836  0.850   0.198 -0.649 -1.43    19 <chr>  
##  9 WP_NUCLEOTIDE_GPCRS          0.0903  0.850   0.198 -0.721 -1.40    11 <chr>  
## 10 WP_TYROBP_CAUSAL_NETWORK_IN… 0.0613  0.850   0.217 -0.515 -1.38    57 <chr>  
## # … with 180 more rows, and abbreviated variable name ¹​leadingEdge
## # ℹ Use `print(n = ...)` to see more rows
## THippo NES ordered fgsea results saved in file: 'THippo_NES_ordered_fgsea_results_APP_only_FC1.csv'
## ************** FGSEA on Thomas CSV: log2FoldChange threshold = 1 **************